package cn.edu.ldu.protocol;

import cn.edu.ldu.modules.controller.AppUserController;
import cn.edu.ldu.modules.entity.UserEntity;
import cn.edu.ldu.util.Consts;
import cn.edu.ldu.views.modules.controller.UserController;
import com.alibaba.fastjson.JSONObject;

public class EditPassword {

    public EditPassword(Protocol protocol){

        UserEntity userEntity = JSONObject.parseObject(protocol.getData(), UserEntity.class);

        try {
            String result = AppUserController.editPassword(userEntity);

            protocol.setKey(result);
            protocol.setData(null);
            UserController.sendDataToUser(protocol);

        } catch (Exception e) {
            e.printStackTrace();
        }


    }

}
